﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program07
{
    /// <summary>
    /// 打折策略选择
    /// </summary>
    class CashStrategy
    {
        private CashSuper _cs;

        public CashStrategy(string type,double rebate=1,decimal maneyCondition = 0M,decimal maneyReturn=0M)
        {
            switch (type)
            {
                case "Normal":
                    this._cs = new CashNormal();
                    break;
                case "Rebate":
                    this._cs = new CashRebate(rebate);
                    break;
                case "Return":
                    this._cs = new CashReturn(maneyCondition,maneyReturn);
                    break;
            }
        }
        public decimal GetTotal(decimal maney)
        {
            return _cs.AcceptCash(maney);
        }
    }
}
